Plugin assemblies
Insights Factory plugins consist of a main plugin assembly and optional dependent assemblies. Both main and dependent assemblies can contain repositories and API controllers or deliver other tools used in the plugin implementation.
Assembly Isolation
Each plugin assembly is loaded using an isolated Assembly Load Context. Thanks to that Repositories can reference third party dependency in any version and it will not cause any errors in runtime.
Each plugin is registered in it's own Dependency Injection Container and can register it's dependencies in Bank Admin, Triggering Engine installers or Insight Definitions Scheduler installer.
Registering dependent assemblies
For dependent assemblies from which the repository or API controller should be loaded into the Insights Factory application, register each assembly in the appropriate installer. Each installer provides a proper dependent assemblies section, where you can define a collection of dependent assemblies. For example:
public class TriggeringEnginePluginInstaller : ITriggeringEnginePluginInstaller
{
...
public IEnumerable<Assembly> DependantAssemblies => new[]
{ typeof(Meniga.InsightsFactory.DependentAssembly.MainClass).Assembly };
...
}
The only special dependent assembly is Meniga.InsightsFactory.DigitalBankingContracts
, where all repository interfaces and built-in controllers are stored. This assembly should always be added if a third-party plugin assembly implements the Meniga plugin interfaces and would like to use the controllers provided by Meniga. DependantAssemblies
in the above example would look like this:
public IEnumerable<Assembly> DependantAssemblies => new[]
{
typeof(Meniga.InsightsFactory.DigitalBankingContracts.Controllers.PluginControllerBase).Assembly,
typeof(Meniga.InsightsFactory.DependentAssembly.MainClass).Assembly
};
Configuration
Plugin assemblies can use following configuration providers:
appsettings.json
using the JSON configuration provider.appsettings.{ASPNETCORE_ENVIRONMENT}.json
using the JSON configuration provider.- Environment variables prefixed with
PLUGINNAME_
using the Environment Variables configuration provider.
Packaging Instructions
Plugin Assembly needs to expose a unique plugin name which will be used to identify the plugin in Insights Factory applications as well as to load plugin configuration.
Basically, the plugin implementation references the Meniga.InsightsFactory.DigitalBankingContracts
library. In this case, there are no special requirements for referencing packages, just refer to the mentioned library in the project csproj
file like as follows:
<PackageReference Include="Meniga.InsightsFactory.BankAdmin.Contracts.External" Version="0.1.0">
However, if the above library is not used, the following conditions must be met in order for Repositories to be correctly loaded and invoked in Insights Factory application runtime:
- Following packages should not be included in the published plugin package. Please exclude them using the
ExcludeAssets
tag in the plugin projectcsproj
file.
Meniga.InsightsFactory.BankAdmin.Contracts.External
Meniga.TriggeringEngine.Contracts.External
<PackageReference Include="Meniga.InsightsFactory.BankAdmin.Contracts.External" Version="0.1.0">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
<PackageReference Include="Meniga.TriggeringEngine.Contracts.External" Version="0.1.0">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>
If the plugin library provides own API controllers then Microsoft.AspNetCore.Mvc
should be also excluded:
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0">
<ExcludeAssets>runtime</ExcludeAssets>
</PackageReference>